#ifndef LGE_JOBQUEUE_H
#define LGE_JOBQUEUE_H

#include <core/lge_queue.h>
#include <queue>
#include <functional>

template<typename A, typename B>
struct Pair
{
	A mFirst;
	B mSecond;
	
	Pair(const A & a, const B & b)
	: mFirst(a), mSecond(b)
	{
	}	
};

typedef std::tr1::function<bool (void)> Job;

struct JobState
{
	volatile bool mDone;
	volatile bool mResult;

	JobState()
	: mDone(false), mResult(false)
	{
	}

	bool done() const
	{
		return mDone;
	}
};

typedef Queue<Pair<Job, JobState*>> JobQueue;

#define createJob(method, ...) std::tr1::bind(method, __VA_ARGS__)

#endif
